#include <bits/stdc++.h>
#define int long long
using namespace std;
const int N = 1e6 + 5;
/*
0 : do nothin'
1 : modify 0
2 : modify 1
3 : xor
4 : modify 0 -> modify 1
5 : modify 1 -> modify 0
6 : xor -> modify 0
7 : xor -> modify 1
*/
int n, f[N][8];
string s, t;
signed main()
{
    freopen("hard.in", "r", stdin);
    freopen("hard.out", "w", stdout);
    ios::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);
    cin >> n >> s >> t, s = ' ' + s, t = ' ' + t;
    f[0][1] = f[0][2] = f[0][3] = f[0][4] = f[0][5] = f[0][6] = f[0][7] = 1e9;
    for (int i = 1; i <= n; ++i)
    {
        int last = min(min(min(f[i - 1][0], f[i - 1][1]), min(f[i - 1][2], f[i - 1][3])),
                       min(min(f[i - 1][4], f[i - 1][5]), min(f[i - 1][6], f[i - 1][7])));
        f[i][1] = min(min(last + 1, f[i - 1][1]), min(min(f[i - 1][4], f[i - 1][5]), f[i - 1][6]));
        f[i][2] = min(min(last + 1, f[i - 1][2]), min(min(f[i - 1][4], f[i - 1][5]), f[i - 1][7]));
        if (s[i] == t[i])
            f[i][0] = last, f[i][3] = 1e9;
        else
            f[i][0] = 1e9, f[i][3] = min(min(last + 1, f[i - 1][3]), min(f[i - 1][6], f[i - 1][7]));
        if (t[i] == '0')
            f[i][2] = f[i][4] = f[i][7] = 1e9,
            f[i][5] = min(f[i - 1][5], f[i - 1][2] + 1),
            f[i][6] = min(f[i - 1][6], f[i - 1][3] + 1);
        else
            f[i][1] = f[i][5] = f[i][6] = 1e9,
            f[i][4] = min(f[i - 1][4], f[i - 1][1] + 1),
            f[i][7] = min(f[i - 1][7], f[i - 1][3] + 1);
    }
    cout << min(min(min(f[n][0], f[n][1]), min(f[n][2], f[n][3])),
                min(min(f[n][4], f[n][5]), min(f[n][6], f[n][7])));
    return 0;
}